﻿<?php
     @session_start();
     if((isset($_SESSION["id"])) && ($_SESSION["id"] == "invite"))
     {
        include("template/headinvite.php");
     }
     else
     {
        include("template/head.php");    
     }
    
  //  include("template/menu_left.php");   
    include("submit/Articles/test_qte.php");
?>
<style>
	.dataTables_filter input{
		height:27px !important;
	}
</style>
    <div class="container-fluid">
        <div class="row-fluid">
                
        <?php 
        if((isset($_SESSION["id"])) && ($_SESSION["id"] == "invite"))
        
        {
         
            $span = 'span12';
        }
        else
        {
            include("template/menu_left.php");
            $span = 'span10';
        }
        
        echo '<div class="'.$span.'" id="content">';
                            

                            //alert submit

                            if ((isset($_GET["action"])) && ($_GET["action"] == "error"))
                            {
                            echo'
                            <div class="alert alert-danger">
                                Aucun Article trouvée <button type="button" class="close" data-dismiss="alert">&times;</button>
                            </div>
                            ';
                            }
							if ((isset($_GET["action"])) && ($_GET["action"] == "access_denied"))
                            {
                            echo'
                            <div class="alert alert-danger"><button type="button" class="close" data-dismiss="alert">&times;</button>
                                Vous n\'avez pas le droit de consulter cette page.<br>
                                Contacter l\'administrateur.</div>
                            ';
                            }
                            if ((isset($_GET["action"])) && ($_GET["action"] == "addedError"))
                                {
                                  echo'
                                   <div class="alert alert-danger">
                                      La réference : <b>'.$_GET["ref"].'</b> existe dejà. <button type="button" class="close" data-dismiss="alert">&times;</button>
                                   </div>';
                                }
                            if ((isset($_GET["action"])) && ($_GET["action"] == "added"))
                            {
                            echo'
                            <div class="alert alert-success">
                                La référence : <b>'.$_GET["ref"].'</b> ajoutée avec succès. <button type="button" class="close" data-dismiss="alert">&times;</button>
                            </div>
                            ';
                            }
                            if ((isset($_GET["action"])) && ($_GET["action"] == "deleted"))
                            {
                            echo'
                            <div class="alert alert-success">
                                Article supprimé avec succès. <button type="button" class="close" data-dismiss="alert">&times;</button>
                            </div>
                            ';
                            }
                            if ((isset($_GET["action"])) && ($_GET["action"] == "updated"))
                            {
                            echo'
                            <div class="alert alert-success">
                                Mise à jour effectuée avec succès. <button type="button" class="close" data-dismiss="alert">&times;</button>
                            </div>
                            ';
                            }

                        ?>  
            <div class="row-fluid">
            <!-- block -->
            <div class="block">
              <div class="navbar navbar-inner block-header">
                <div class="muted pull-left">Listes des Articles (<?php  $num = mysql_num_rows($result); echo $num ; ?>)</div>
                <div class="pull-right">
                	<?php
		                if($user['account_login']=="admin")
						echo '<a class="btn btn-primary btn-sm" href="add_article.php?page=nouvel_article" style="float:right;width:200px;margin-bottom:10px;" >Ajouter un article</a>';
		             ?>
                </div>
              </div>
              <div class="block-content collapse in">
                <div class="span12">
                    <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example">
                    <thead>
                      <tr>
                        <th>Référence</th>
                        <th style="width: 550px;">Désignation</th>
                        <th>Qté Stock</th>
                        <th>Prix de Vente</th>
                        <th></th>
                      </tr>
                    </thead>
                    <tbody>
                       <?php    
                        while($row = mysql_fetch_object($result))
                        {
                        ?>
        
                      <tr class="odd gradeX">
                        <td><a class="fancybox-effects-a" href="<?php echo $row->photo_name;?>"><?php echo $row->ref_article ?></a> </td>
                        <td><?php echo $row->designation ?></td>
                        <td class="center" style="color:#d0343a;text-align:center;"><?php 
                        
                        
                        
                        echo number_format($row->Quantite, 0, '', ' ')?></td>
                        <td class="center"  style="text-align:center;"><?php echo number_format($row->prix, 3, '.', ' '); ?></td>
                        <td>
                            <a href="view_article.php?page=list_article&id_monnaie=<?php echo $row->id_type_monnaie.'&id_article='.$row->id_article?>" class="btn btn-small" style="margin-right:20px;">Consultation</a>      
                            <?php 
					        if((isset($_SESSION["id"])) && ($_SESSION["id"] == "invite"))
					        
					        {
							}
							else {
								echo'
					  <a class="btn btn-primary btn-small" href="edit_article.php?page=list_article&id_article='.$row->id_article.'"><i class="icon-pencil icon-white"></i></a>
                            <a href="#myModal'.$row->id_article.'" data-toggle="modal"  class="btn btn-danger btn-small"><i class="icon-remove icon-white"></i></a>  
                        	
                        	<div id="myModal'.$row->id_article.'" class="modal hide">
								<div class="modal-header">
									<button data-dismiss="modal" class="close" type="button">&times;</button>
										<p>Voulez-vous supprimer l\'article Ref. '.$row->ref_article.' </p>
			
									</div>
								
									<div class="modal-footer">
										<a class="btn btn-primary" href="submit/Articles/delete_article.php?id='.$row->id_article.'">Confirmer</a>
										<a data-dismiss="modal" class="btn" href="#">Annuler</a>
									</div>
							</div>
				
			';
		}
                   
				   ?>       
                        </td>
                      </tr>
                      <?php
                        }
                      ?>
                    </tbody>
                  </table>
                </div>
                <?php
                if($user['account_login']=="admin")
				echo '<a class="btn btn-primary btn-sm" href="add_article.php?page=nouvel_article" style="float:right;width:200px;margin:20px;" >Ajouter un article</a>';
              	?>
              </div>
            </div>
        <!-- /block -->
          </div>
                </div>
            </div>
            <hr>
        </div>
<?php  include("template/footer.php") ; ?>